package cl.indumotora.induapprecepcion.app;

import cl.indumotora.induapprecepcion.bean.UsuarioBean;
import cl.indumotora.induapprecepcion.ln.LoginLn;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

public class HomeRecepActivity extends Activity {

	private TextView tv_user;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_home_recep);
		
		tv_user=(TextView)findViewById(R.id.tv_usuario);
		
		//Recuperamos las preferencias almacenadas
		SharedPreferences prefs = getSharedPreferences("MisPreferencias",Context.MODE_PRIVATE);
		String name = prefs.getString("name", "");
		String pass = prefs.getString("pass", "");
		
		UsuarioBean userBean = LoginLn.getUsuario(name, pass);
		tv_user.setText(userBean.getNOMBR());
	}
	
	
	public void btnVerAgenda_onClick(View view){	
		try {
			Intent agenda = new Intent(HomeRecepActivity.this, VerAgendaActivity.class);
		     startActivity(agenda);
		}catch(Exception ex){
			Log.i("INFO", "Clase: MainActivity - Metodo: btnVerAgenda_onClick");
		}
	}
	
	public void btnIngSinHora_onClick(View view){	
		try {
		   Intent Cliente = new Intent(HomeRecepActivity.this, ClienteActivity.class);
		   startActivity(Cliente);
		
		}catch(Exception ex){
			Log.i("INFO", "Clase: MainActivity - Metodo: btnIngSinHora_onClick");
		}
	}
	
}
